package com.young.springdemo.service.factoryMethod;

import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;

@Component
public class TestPhone {

//    @PostConstruct
    public void testPhone() {
        try {
            Class<?> phone = Class.forName("com.young.springdemo.service.factoryMethod.TclFactory");
            Factory factory = (Factory) phone.newInstance();
            Phone telephone = factory.createPhone();
            System.out.println(telephone.getBrand()+"===="+telephone.getDesc()+"===="+telephone.getPrice());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
